package instentof;

public class Test {

	public static void doSomeThing(Animal animal){
		animal.say();
		
		if(animal instanceof Dog){
			((Dog) animal).cry();
		}else if(animal instanceof Cat){
			((Cat) animal).eat();
		}
	}
	
	public static void main(String[] args) {
		Animal a = new Dog();
		System.out.println(a instanceof Animal);
		System.out.println(a instanceof Dog);
		System.out.println(a instanceof Cat);
		
		doSomeThing(new Dog());
		doSomeThing(new Cat());
	}
}
